home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
tex-k
/
tex-eplain-archive
/
000028_dorai@ses.com_Tue Aug 30 06:59:04 1994.msg
< prev
next >
Wrap
Internet Message Format
|
1995-01-08
|
3KB
Received: from uu10.psi.com by cs.umb.edu with SMTP id AA25172
(5.65c/IDA-1.4.4 for <tex-eplain@cs.umb.edu>); Tue, 30 Aug 1994 12:59:20 -0400
Received: from mario.ses.com by uu10.psi.com (5.65b/4.0.061193-PSI/PSINet) via SMTP;
id AA02897 for tex-eplain@cs.umb.edu; Tue, 30 Aug 94 13:02:01 -0400
Date: Tue, 30 Aug 94 11:59:04 CDT
From: dorai@ses.com (Dorai Sitaram)
Received: from frodo.ses.com (frodo.ARPA) by ses.com (4.1/3.1.012693-SES - Scientific and Engineering Software);
id AA24782 for tex-eplain@cs.umb.edu; Tue, 30 Aug 94 11:59:04 CDT
Message-Id: <9408301659.AA24782@ses.com>
To: tex-eplain@cs.umb.edu
Subject: Copying from TeX source verbatim to a file
We all know that TeX allows writing stuff during the
course of TeXing to a temp file, e.g., eplain's code
for managing tocs and indexes. I suggest that a
generalized macro for copying portions of a TeX source
file verbatim to another file (whether .doc, .mf or
another .tex file) can be a nice addition to eplain. I
just downloaded Zdenek Wagner's drawing.tex, and found
that he uses this tactic to copy stuff from his main
file into an .mf file. To do this, he uses the old
Mainz verbatim.sty that gives him some programmable
hooks, and while I understand what it does, I don't
really know how it does it.
I found this strategy of using TeX to write stuff into
other files in other places too, e.g., the old Mainz
distribution's docstrip utility which is rather too
complex for our purposes, and a much simpler file
called wrtfile.tex by Cameron Smith that does something
similar for plain TeX. Here's a very simple macro with
just the barebones transcripting ability. It follows
Cameron Smith but doesn't have any of the extra
features that he provides.
Usage:
\transcript <filename>
...
<arbitrary ascii stuff>
...
endtranscript
This will copy the <arbitrary ascii stuff> verbatim to
the file <filename>. You can change the string that
signals end of transcript by redefining \endtranscript.
Initially, \def\endtranscript{endtranscript}.
Code follows. Please ignore if this is old hat.
--d
% trnscrpt.tex
\begingroup
\catcode`\^^M=12%
% the following %'s are necessary --- don't remove!
\gdef\transcript #1 {\begingroup%
\immediate\openout0=#1\relax
\def\do##1{\catcode`##1=12\relax}\dospecials%
\catcode`\^^M=12\relax%
\transcriptreadline}%
%
\gdef\transcriptreadline#1^^M{%
\def\transcriptreadlinearg{#1}%
\ifx\transcriptreadlinearg\endtranscript%
\def\next{\immediate\closeout0\endgroup}\else%
\def\next{\immediate\write0{#1}\transcriptreadline}\fi%
\next}%
\endgroup
\def\endtranscript{endtranscript}
% end of file